<template name="backupcopy">
  <view class="backupcopy">
    <text class="back_title">Under Review</text>

    <view class="back_icon">
      <image src="../../static/back_icon.png" mode=""></image>
      <text class="bicon_txt"
        >You application information has been submitted and will be reviewed
        within 3 minytes</text
      >
    </view>
    <button class="back_refresh" @click="REFRESH">REFRESH</button>
    <uni-popup ref="popup" type="center" :mask-click="false">
      <view class="returns" @click="add()">
        <image class="pop-img" src="../../static/baoxiang.png" mode=""></image>
      </view>
    </uni-popup>
  </view>
</template>

<script>
// import { number } from 'echarts';
export default {
  data() {
    return {
      times: 1000*60*1,
    };
  },
  onLoad() {
	 const endTime = Date.now();
	 // (Date.parse(new Date()) - uni.getStorageSync('times'))/1000
	// if(Date.now()- Number(uni.getStorageSync('poptime'))>=this.times){
	// 	this.openpop(0)
	// }else{
	// 	this.openpop(this.times- (Date.now() - Number(uni.getStorageSync('poptime')) ))
	// }
	if(uni.getStorageSync('backupcopyfirst')){
		return;
	}else{
		if ((Date.parse(new Date()) - uni.getStorageSync('times'))/1000 > 180) {
			this.openpop()
		}else{
			let time=  180000 - (Date.parse(new Date()) - uni.getStorageSync('times'))
			this.openpop(time)
		}
	}
	
  },
  onShow() {
  	 uni.setStorageSync('currentPage', '/pages/backupcopy/backupcopy');
  },
  methods: {
    // 按钮点击不让反应
    REFRESH() {
      // uni.navigateTo({
      // 	url:"/pages/index/index"
      // })
    },
    // 关闭下拉刷新
    onPullDownRefresh() {
      setTimeout(function () {
        uni.stopPullDownRefresh();
      }, 1000);
    },
    // 三分钟后弹出一个百宝箱
    openpop(val) {
      // let time =1000*60*1
      // let time = 1000;
	  if (val) {
	  	setTimeout(() => {
	  	  this.$refs.popup.open("center");
	  	}, val);
	  } else{
		setTimeout(() => {
		  this.$refs.popup.open("center");
		}, 0);
	  }
    },
    // closepop() {
    // 	this.$refs.popup.close()
    // },
    // 关闭弹窗 跳转额度选择界面
    add() {
		uni.setStorageSync('backupcopyfirst',1)
      this.$refs.popup.close();
      // uni.navigateTo({
      // 	url:"/pages/huxing/huxing"
      // })
      uni.reLaunch({
        url: "/pages/huxing/huxing",
      });
      this.$refs.popup.close();
		// uni.removeStorageSync("currentPage");
		 uni.setStorageSync('currentPage', '/pages/huxing/huxing');
		
      // uni.navigateTo({
      // 	url:"/pages/index/index"
      // })
    },
  },
   onUnload() {
	   // uni.setStorageSync('poptime',Date.now())
      uni.setStorageSync('currentPage', '/pages/backupcopy/backupcopy'); // 保存当前页面到本地存储
	  // console.log(uni.setStorageSync('currentPage'))
    }
  ,
  onBackPress(e) {
	  uni.setStorageSync('currentPage', '/pages/backupcopy/backupcopy'); // 保存当前页面到本地存储
	
    return true;
  },
};
</script>

<style>
page {
  width: 100%;
  height: 100%;
  background-color: rgba(213, 48, 48, 1);
}

.backupcopy {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 150rpx;
  padding-left: 30rpx;
  padding-right: 30rpx;
  box-sizing: border-box;
}

.back_title {
  font-size: 40rpx;
  font-family: "SourceHanSansSC-Regular", "SourceHanSansSC";
  font-weight: 400;
  color: #ffffff;
  line-height: 58rpx;
  letter-spacing: 2rpx;
}

.back_icon {
  width: 100%;
  display: flex;
  flex-direction: column;
  margin-top: 132rpx;
  align-items: center;
}

.back_icon image {
  width: 330rpx;
  height: 446rpx;
  margin-bottom: 72rpx;
}

.back_icon .bicon_txt {
  font-size: 36rpx;
  font-family: " SourceHanSansSC-Regular", "SourceHanSansSC";
  font-weight: 400;
  color: #ffffff;
  line-height: 52rpx;
  text-align: center;
  margin-bottom: 208rpx;
}

.back_refresh {
  width: 100%;
  height: 100rpx;
  background: #ffffff;
  border-radius: 16rpx;
  font-size: 34rpx;
  font-family: " SourceHanSansSC-Medium", "SourceHanSansSC";
  font-weight: 600;
  color: #d53030;
  line-height: 100rpx;
}

.returns {
  width: 100% !important;
  padding: 45rpx;
}

.pop-img {
  width: 748rpx;
  height: 742rpx;
  margin: 15rpx auto 35rpx;
  display: block;
}
</style>
